<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>使用Vue3完成和后台交互</title>
</head>
<body>
<div id="root">
    <button @click="click">获取用户信息</button>
    <ul>
        <li v-for="user in users">{{user}}</li>
    </ul>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.26.1/axios.min.js"></script>
<script>
    const EventHandling = {
        data() {
            return {
                users: []
            }
        },
        methods: {
            click(){
                axios.get("/users/get").then((reps)=>{
                    console.log(reps.data)
                    this.users=reps.data
                });
            }
        }
    }

    Vue.createApp(EventHandling).mount('#root')

</script>
</body>
</html>